package com.learn.project2.controller.wx.catalog;

import com.learn.project2.model.vo.wx.catalog.CatalogCurrentVO2;
import com.learn.project2.model.vo.wx.catalog.CatalogIndexVO2;
import com.learn.project2.service.wx.catalog.CatalogService2;
import com.learn.project2.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 曹源
 * @version 1.0
 * @description: 微信小程序 /wx/catalog的控制方法
 * @date 2022/1/10 14:36
 */
@RestController
@RequestMapping("wx/catalog")
public class CatalogController2 {
    @Autowired
    CatalogService2 catalogService2;

    Result result;

    /**
     * @description: 微信小程序 /wx/catalog/current的控制方法
     * @param:
     * @return:
     * @author 曹源
     * @date: 2022-01-10 14:37
     */
    @RequestMapping("current")
    public Result current(Integer id) {
        CatalogCurrentVO2 catalogCurrentVO = catalogService2.selectById(id);
        return result.ok(catalogCurrentVO);
    }

    /**
     * @description: 微信小程序 /wx/catalog/index的控制方法
     * @param:
     * @return:
     * @author 曹源
     * @date: 2022-01-10 14:38
     */
    @RequestMapping("index")
    public Result index() {
        CatalogIndexVO2 catalogIndexVO = catalogService2.selectIndex();
        return Result.ok(catalogIndexVO);
    }

}
